gh-145260: fix ResourceContainer/ResourceHandle for Traversable changes#145263
gh-145260: fix ResourceContainer/ResourceHandle for Traversable changes#145263zetzschest wants to merge 5 commits intopython:mainfrom
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
b7cc205 to
efdc545
Compare
ericvsmith
left a comment
There was a problem hiding this comment.
I haven't looked at the PR in detail, but please add tests so we can ensure this keeps working.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
e0fa982 to
38aab31
Compare
… ResourceHandle ResourceContainer and ResourceHandle could not be instantiated because Traversable now requires name as an abstract property. Additionally, ResourceContainer.iterdir() accessed self.reader.resources without calling it, and ResourceHandle.joinpath had a signature mismatch. - Add name property to ResourceContainer - Fix self.reader.resources -> self.reader.resources() call - Add iterdir() method to ResourceHandle - Fix ResourceHandle.joinpath to accept *descendants
Add tests for ResourceContainer and ResourceHandle classes to verify: - ResourceContainer instantiation with name property - ResourceContainer.iterdir() calling resources() method - ResourceHandle.joinpath() accepting *descendants parameter - ResourceHandle.iterdir() returning empty iterator - ResourceHandle name as property instead of instance variable Also fix ResourceHandle.name to be a property to satisfy Traversable abstract base class requirements.
38aab31 to
d95ab35
Compare
Problem
ResourceContainerandResourceHandlecannot be instantiated becauseTraversablenow requiresnameas an abstract property. Also,iterdir()accessesself.reader.resourceswithout calling it, andResourceHandle.joinpathhas a signature mismatch.Reproducer
Fix
nameproperty toResourceContainerandResourceHandleiterdirtoResourceHandleself.reader.resources→self.reader.resources()inResourceContainer.iterdir()ResourceHandle.joinpathto accept*descendants